/*
 * @Author: Zcl84765
 * @Date: 2023-01-18 16:13:25
 * @LastEditors: Zcl84765
 * @LastEditTime: 2023-01-18 17:01:07
 */

import Vue from 'vue'
import router from '../router'

Vue.directive('permission', {
  inserted: function (el, binding) {
    //被绑定的元素插入父节点的时候调用(父节点存在即可调用，不必存在document中)
    const action = binding.value.action
    const desable = binding.value.desable
    let rightList = router.currentRoute.meta
    if (!rightList.includes(action)) {
      el.parentNode.removeChild(el)
    }
  },
})
